﻿using System;
using System.Web;
using SyCODE.Component;
using SyCODE.Component.DataFactory;
using System.Data.Common;

namespace SyCODE.Blog
{
    /// <summary>
    /// CheckAccount.aspx 的处理程序
    /// 作用：
    ///   检测用户名是否已经存在  
    /// </summary>
    public class CheckAccount : IHttpHandler
    {
        public bool IsReusable
        {
            get
            {
                return true;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            DBAM dbam = new DBAM();
            dbam.BuildParameters("checkaccount", context.Request.Form);

            try
            {
                DbDataReader dr = dbam.ExecuteReader();

                if (dr.Read())
                    context.Response.Write(dr.GetString(0));

                dr.Close();
            }
            finally
            {
                dbam.Dispose();
            }
        }
    }
}
